package com.upstairstechnology.oi.notification;

import java.util.Set;

import org.springframework.beans.factory.annotation.Required;

import com.upstairstechnology.oi.notification.email.NotificationConfigurationEmail;
import com.upstairstechnology.oi.notification.email.resolver.EmailResolver;

/**
 * Factory methods to create notification strategies.
 * 
 * @author Jeff Jensen
 */
public interface NotificationStrategyFactory {
    /**
     * Make a set of NotificationStrategy classes from the configured
     * notificationStrategies.
     * 
     * @throws ClassNotFoundException
     *             When the specified notification strategy class is not found.
     * @throws IllegalAccessException
     *             When no permission to create a new instance of the specified
     *             notification strategy class.
     * @throws InstantiationException
     *             When unable to create a new instance of the specified
     *             notification strategy class.
     * @return A set of notification strategies.
     */
    Set<NotificationStrategy> makeNotifications()
            throws ClassNotFoundException, InstantiationException,
            IllegalAccessException;

    /**
     * Set the EmailConfiguration, the configuration for sending emails.
     * 
     * @param cfg
     *            The EmailConfiguration to set.
     */
    @Required
    void setEmailConfiguration(NotificationConfigurationEmail cfg);

    /**
     * Set the emailResolver, the strategy to convert SCM user ids to email
     * addresses.
     * 
     * @param resolver
     *            The emailResolver to set.
     */
    @Required
    void setEmailResolver(EmailResolver resolver);
}
